package com.train.service.impl;

import com.train.mapper.UserMapper;
import com.train.pojo.po.User;
import com.train.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @Desc:用户业务层，做业务逻辑
 * @author：王佳驹
 * @date：2025/05/12
 */
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {

    private final UserMapper mapper;
    /**
     * @param phone 手机号
     * @param password 密码
     * @Desc 用户登录
     * @author wjj
     * @date 2025/05/12
     * @return {@link String }
     */
    @Override
    public String login(String phone, String password) {
        User user = mapper.selectByPhone(phone);
        if (user == null) {
            return "404";
        }
        if (user.getPassword().equals(password)) {
            return "success";
        }
        return "fail";
    }
}
